package com.ccb.jyzx.expand.tiantouonline.job;

import com.ccb.jyzx.expand.tiantouonline.utils.ConstantUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @projectName: extend
 * @author: jianghaolin
 * @date: 2019/11/21
 * @version: 1.0
 */
@Component
public class BathchJobRunnable implements  Runnable {

    private  int methodIndex =0;

    @Autowired
    private BatchJobExecute batchJobExecute;

    /**
     * 定时任务执行接口
     */
    @Override
    public void run() {
        if(methodIndex == ConstantUtil.METHOD_INDEX_AM){
            batchJobExecute.scheduledAm();
        }else if(methodIndex == ConstantUtil.METHOD_INDEX_PM){
            batchJobExecute.scheduledPm();
        }

    }

    public void setMethodIndex(int methodIndex) {
        this.methodIndex = methodIndex;
    }

    public int getMethodIndex() {
        return methodIndex;
    }

    public void setBatchJobExecute(BatchJobExecute batchJobExecute) {
        this.batchJobExecute = batchJobExecute;
    }

    public BatchJobExecute getBatchJobExecute() {
        return batchJobExecute;
    }
}
